package com.alliance.shuwei.entity;

import java.util.List;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@Entity
@Table(name = "resource_provider")
@JsonIgnoreProperties(value = { "users", "resources" })
public class ResourceProvider extends Auditable {
	@Id
	@GeneratedValue
	@Column(name = "resource_provider_id")
	private Integer id;
	private String name;
	private String description;
	@Embedded
	private Address address;
	@ElementCollection
	@CollectionTable(name = "resource_provider_contact_info", joinColumns = @JoinColumn(name = "resource_provider_id"))
	@JsonProperty("contact_info")
	private List<ContactInfo> contactInfos;
	@ManyToMany(mappedBy = "resourceProviders")
	private List<User> users;
	@OneToMany(mappedBy = "resourceProvider")
	private List<CultureResource> resources;
	@ManyToMany
	@JoinTable(name = "resource_provider_category", joinColumns = @JoinColumn(name = "resource_provider_id"), inverseJoinColumns = @JoinColumn(name = "category_id"))
	private List<Category> categories;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public List<ContactInfo> getContactInfos() {
		return contactInfos;
	}

	public void setContactInfos(List<ContactInfo> contactInfos) {
		this.contactInfos = contactInfos;
	}

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	public List<CultureResource> getResources() {
		return resources;
	}

	public void setResources(List<CultureResource> resources) {
		this.resources = resources;
	}

	public List<Category> getCategories() {
		return categories;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

}
